<?php


namespace api\zhengmaotong\controller;


use api\zhengmaotong\model\NavModel;
use cmf\controller\RestBaseController;

class NavController extends RestBaseController
{
    public function index()
    {
        $keyword = input('keyword', '');
        $where = [];
        if ($keyword) {
            $where[] = ['id', 'like', '%' . $keyword . '%'];
        }

        //页码
        $page = input('page/d', 1);
        //每页返回的条数
        $pageSize = input('page_size/d', 10);
        $list =NavModel::where($where)
            ->order('list_order', 'desc')
            ->field('id,title,image,url')
            ->page($page, $pageSize)
            ->select();

        $this->success('导航菜单表', $list);
    }
}